DAY7:Count by X


Posted by birdbirdmurmur on 2023-07-20

題目連結:

Count by X

思考邏輯:

1.總共有n個數字,
2.每個數字都要乘上x
3.塞進z陣列

解法:

function countBy(x, n) {
  let z = [];
  for (let i=1; i<=n ;i++){
    z.push(x*i)
  }
  return z;
}

#javascript #Codewars







Related Posts

ElementPlus的自定義主題

ElementPlus的自定義主題

將 ChatGPT LineBot 部屬在 Google Scripts 上

將 ChatGPT LineBot 部屬在 Google Scripts 上

簡單入門 Grid 屬性/用法/使用情境

簡單入門 Grid 屬性/用法/使用情境


Comments